<!--


Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->

<div id="chartDatesForm">
    <form name="chartDatesForm" class="form-inline" role="form">
        <div class="form-group">
            <div class="start-dropdown" uib-dropdown is-open="startDropdown.isopen">
                <button id="start-button" type="button" class="dates-btn btn btn-link" uib-dropdown-toggle>
                    <div class="input-group">
                        <span class="input-group-addon"><strong>From:</strong></span>
                        <input type="text" class="form-control date-text" formatted-date data-ng-model="chartData.start" ng-disabled="true">
                    </div>
                </button>
                <ul class="uib-dropdown-menu datetimepicker-dropdown-menu" role="menu" aria-labelledby="start-button">
                    <datetimepicker data-ng-model="chartData.start" data-on-set-time="setStart(newDate, oldDate); closeStart()" data-datetimepicker-config="{ minuteStep: 1 }"/>
                </ul>
            </div>
        </div>
        <div class="form-group">
            <div class="end-dropdown" uib-dropdown is-open="endDropdown.isopen">
                <button id="end-button" type="button" class="dates-btn btn btn-link" uib-dropdown-toggle>
                    <div class="input-group">
                        <span class="input-group-addon"><strong>To:</strong></span>
                        <input type="text" class="form-control date-text" formatted-date data-ng-model="chartData.end" ng-disabled="true">
                    </div>
                </button>
                <ul class="uib-dropdown-menu datetimepicker-dropdown-menu" role="menu" aria-labelledby="end-button">
                    <datetimepicker data-ng-model="chartData.end" data-on-set-time="setEnd(newDate, oldDate); closeEnd()" data-datetimepicker-config="{ minuteStep: 1 }"/>
                </ul>
            </div>
        </div>
        <div class="form-group">
            <div class="input-group">
                <span class="input-group-btn">
                    <button id="applyBtn" class="apply-btn btn btn-default" type="button" ng-click="changeDates(chartData.start, chartData.end); chartData.autoRefresh = false;" uib-popover="Apply selected dates" popover-trigger="mouseenter" popover-placement="bottom" popover-append-to-body="true" popover-class="popover-class">Apply</button>
                    <button id="pauseBtn" class="pause-btn btn btn-default" type="button" ng-show="showAutoRefreshBtn && chartData.autoRefresh" ng-click="toggleAutoRefresh();" uib-popover="Pause live update" popover-trigger="mouseenter" popover-placement="bottom" popover-append-to-body="true" popover-class="popover-class"><i class="fa fa-pause"></i></button>
                    <button id="playBtn" class="play-btn btn btn-default" type="button" ng-show="showAutoRefreshBtn && !chartData.autoRefresh" ng-click="toggleAutoRefresh();" uib-popover="Start live update" popover-trigger="mouseenter" popover-placement="bottom" popover-append-to-body="true" popover-class="popover-class"><i class="fa fa-play"></i></button>
                </span>
                <input id="rangeInput" type="text" class="form-control chart-range-input" placeholder="Range" uib-popover="Override the date range in the format 1m, 2h, 3d, 4w or 5M and hitting enter." popover-trigger="mouseenter" popover-placement="bottom" popover-append-to-body="true" popover-class="popover-class" ng-model="tempChartData.range" enter="applyRange()" ng-blur="revertRange()" select-on-click>
            </div>
        </div>
    </form>
</div>
